SPB Git
1import type { Metadata } from "next";2import { notFound } from "next/navigation";3import { getLocale } from "@/lib/i18n/server";4import { t } from "@/lib/i18n";5import { getMethod, listPapers } from "@/lib/papers/queries";6import { PaperRow } from "@/components/paper-items";7export const revalidate = 300;8export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> { const { slug } = await params; const x = await getMethod(slug); const locale = await getLocale(); return x ? { title: locale === "fr" ? x.name_fr : x.name_en, alternates: { canonical: `/methods/${slug}` } } : {}; }9export default async function MethodPage({ params }: { params: Promise<{ slug: string }> }) {10  const { slug } = await params; const locale = await getLocale(); const d = t(locale); const x = await getMethod(slug); if (!x) notFound();11  const res = await listPapers({ method: [slug], sort: "recent", perPage: 100 });12  return (<div className="container py-10"><p className="kicker">{d.papers.method} · {x.category}</p><h1 className="text-3xl sm:text-4xl mt-2">{locale === "fr" ? x.name_fr : x.name_en}</h1>{(locale === "fr" ? x.description_fr : x.description_en) && <p className="meta mt-2 max-w-3xl">{locale === "fr" ? x.description_fr : x.description_en}</p>}<p className="meta mt-3">{res.total} {res.total === 1 ? d.topics.paper : d.topics.papers}</p><div className="card px-5 mt-6">{res.items.map((p) => <PaperRow key={p.id} p={p} locale={locale} />)}</div></div>);13}14
Files · main
Menu

Theme